package bb.lanxing.common.anim;

import android.content.Context;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;

public class MapbottomBarAnim extends AnimationSet {
    private AlphaAnimation mAnimAlpha;
    private TranslateAnimation mAnimTrans;
    private Context mContext;
    private int mTranY;
    private boolean mbDoShowAnim;

    public MapbottomBarAnim(boolean shareInterpolator) {
        super(shareInterpolator);
        this.mContext = null;
        this.mTranY = 0;
        this.mbDoShowAnim = false;
        this.mAnimTrans = null;
        this.mAnimAlpha = null;
    }

    public void onCreate(Context context, int tranY, boolean doShowAnim) {
        this.mContext = context;
        this.mTranY = tranY;
        this.mbDoShowAnim = doShowAnim;
        init();
    }

    private void init() {
        if (this.mbDoShowAnim) {
            this.mAnimTrans = new TranslateAnimation(0.0f, 0.0f, this.mTranY, 0.0f);
            this.mAnimAlpha = new AlphaAnimation(0.0f, 1.0f);
        } else {
            this.mAnimTrans = new TranslateAnimation(0.0f, 0.0f, 0.0f, this.mTranY);
            this.mAnimAlpha = new AlphaAnimation(1.0f, 0.0f);
        }
        addAnimation(this.mAnimTrans);
        addAnimation(this.mAnimAlpha);
        setDuration(200L);
        setFillAfter(true);
        if (this.mbDoShowAnim) {
            setInterpolator(this.mContext, android.R.anim.decelerate_interpolator);//17432582
        } else {
            setInterpolator(this.mContext, android.R.anim.accelerate_interpolator);//17432581
        }
        setZAdjustment(-1);
    }
}
